{extend name="base:base" /}
{block name="body"}
<div class="layui-card layui-form">
    <div class="layui-card-body">
        <table class="layui-table">
            <colgroup>
                <col>
                <col width="100">
            </colgroup>
            <thead>
                <tr>
                    <th>模板</th>
                    <th>选择</th>
                </tr> 
            </thead>
            <tbody>
                <?php
                foreach ($lists as $key => $value) {
                    ?>
                    <tr>
                        <td><?php echo $value ?></td>
                        <td><a data-val="<?php echo $value ?>" class="layui-btn layui-btn-normal layui-btn-sm select">选择</a></td>
                    </tr>
                <?php } ?> 
            </tbody>
        </table>
        <input type="hidden" id="inpuuname" value="" />
    </div>
</div>
{/block}
{block name="foot_js"}
<script>
    layui.use(['jquery', 'layer'], function () {
        var layer = layui.layer
                , $ = layui.jquery;
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.iframeAuto(index);
        $('.select').click(function () {
            var val = $(this).data('val');
            if (val === '') {
                parent.layer.msg('请填写标记');
                return;
            }
            // parent.layer.msg('您将标记 [ ' + val + ' ] 成功传送给了父窗口');
            var id = $('#inpuuname').val();
            parent.layui.$('#' + id).attr('value', val);
            parent.layer.close(index);
        });
    });
</script>
{/block}